/**
 * 用户访问权限守卫
 */
import type { Router } from 'vue-router'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

export function gruadProgress(router: Router) {
  NProgress.configure({
    showSpinner: false, // 隐藏加载图标
    trickleSpeed: 500, // 进度条流动速度
    minimum: 0.3, // 最小显示进度
  })
  router.beforeEach((to, from, next) => {
    NProgress.start()
    next()
  })
  router.afterEach(() => {
    NProgress.done()
  })
}
